package com.exam.mapper;

import com.exam.entity.Replay;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface ReplayMapper {

    @Select("select messageId,replay,replayTime from replay")
    List<Replay> findAll();

    @Select("select messageId,replay,replayTime from replay where messageId = #{messageId}")
    List<Replay> findAllById(String messageId);

    @Select("select messageId,replay,replayTime from replay where messageId = #{messageId}")
    Replay findById(String messageId);

    @Delete("delete from replay where id = #{id}")
    int delete(String id);

    @Update("update replay set title = #{title}, replay = #{replay}, replayTime = #{replayTime} where id = #{idno}")
    int update(Replay replay);

    @Insert("insert into replay(id,messageId,replay,replayTime) values(#{id},#{messageId}, #{replay},#{replayTime})")
    int add(Replay replay);
}
